package org.hot100_1;


import java.util.ArrayList;
import java.util.List;

public class leetcode36 {
    class TreeNode{
        TreeNode left;
        TreeNode right;
        int val;
        public TreeNode(){};
        public TreeNode(int val,TreeNode left,TreeNode right){
            this.val=val;
            this.left=left;
            this.right=right;
        }

        public TreeNode(int val){
            this.val=val;
        }
    }
    public List<Integer> inorderTraversal(TreeNode root) {

        List<Integer> res = new ArrayList<>();
        inorder(root,res);
        return res;
    }

    private void inorder(TreeNode node ,List<Integer> list){
        if (node==null){
            return;
        }
        inorder(node.left,list);
        list.add(node.val);
        inorder(node.right,list);
    }
}
